clear
capture log close
log using Log_TableA7.txt, replace text


use Study1data_publicdatafile_cleaned.dta
append using Study2data_publicdatafile_cleaned.dta, force

label define x_hhi 1 `"Less than $14,999"', modify
label define x_hhi 2 `"$15,000 to $19,999"', modify
label define x_hhi 3 `"$20,000 to $24,999"', modify
label define x_hhi 4 `"$25,000 to $29,999"', modify
label define x_hhi 5 `"$30,000 to $34,999"', modify
label define x_hhi 6 `"$35,000 to $39,999"', modify
label define x_hhi 7 `"$40,000 to $44,999"', modify
label define x_hhi 8 `"$45,000 to $49,999"', modify
label define x_hhi 9 `"$50,000 to $54,999"', modify
label define x_hhi 10 `"$55,000 to $59,999"', modify
label define x_hhi 11 `"$60,000 to $64,999"', modify
label define x_hhi 12 `"$65,000 to $69,999"', modify
label define x_hhi 13 `"$70,000 to $74,999"', modify
label define x_hhi 14 `"$75,000 to $79,999"', modify
label define x_hhi 15 `"$80,000 to $84,999"', modify
label define x_hhi 16 `"$85,000 to $89,999"', modify
label define x_hhi 17 `"$90,000 to $94,999"', modify
label define x_hhi 18 `"$95,000 to $99,999"', modify
label define x_hhi 19 `"$100,000 to $124,999"', modify
label define x_hhi 20 `"$125,000 to $149,999"', modify
label define x_hhi 21 `"$150,000 to $174,999"', modify
label define x_hhi 22 `"$175,000 to $199,999"', modify
label define x_hhi 23 `"$200,000 to $249,999"', modify
label define x_hhi 24 `"$250,000 and above"', modify
label define x_hhi 25 `"Refused"', modify
label values x_hhi x_hhi

recode x_hhi (1/3=1) (4/7=2) (8/11=3) (12/15=4) (16/19=5) (20/24=6) (25=7), gen(x_hhi_collapsed)
label define x_hhi_collapsed 1 "<$25,000" 2 "$25K to <$45K" 3 "$45K to <$65K" 4 "65K to <$85K" 5 "$85K to <$125K" 6 "$125K+" 7 "Refused"
label values x_hhi_collapsed x_hhi_collapsed
label var x_hhi_collapsed "Income"

gen x_education_alt=.
replace x_education_alt=1 if x_education==`"Some high school or less"'
replace x_education_alt=1 if x_education==`"High school graduate"'
replace x_education_alt=2 if x_education==`"Other post high school vocational training"'
replace x_education_alt=2 if x_education==`"Completed some college, but no degree"'
replace x_education_alt=2 if x_education==`"Associate's degree"'
replace x_education_alt=3 if x_education==`"Bachelor's degree"'
replace x_education_alt=4 if x_education==`"Doctorate degree"'
replace x_education_alt=4 if x_education==`"Master's or professional degree"' 

label define x_education_alt 1 "HS or less" 2 "Some college/Associates degree" 3 "BA" 4 "Post-grad degree"
label values x_education_alt x_education_alt
label var x_education_alt "Education"

label var x_age "Age (years)"
label var x_race "Race/Ethnicity"
label var x_female "Female (1=yes)"
label var x_region "Region"
label var x_pid_3 "Partisanship"

bysort study: summ x_age

foreach var of varlist x_race x_female x_education_alt x_hhi_collapsed x_region x_pid_3 {
	tab `var' study, col nofreq
	}

log close
